package util;

import edu.stanford.nlp.pipeline.StanfordCoreNLP;

import java.util.Properties;

public class PipelineUtil {
    private static PipelineUtil ourInstance = new PipelineUtil();

    private StanfordCoreNLP pipeline;

    private static final String BASE_ANNOTATORS = "tokenize, ssplit, pos, lemma";
    private static final String PARSE_ANNOTATORS = "tokenize, ssplit, pos, lemma, parse";
    private static final String FULL_ANNOTATORS = "tokenize, ssplit, pos, lemma, ner, parse, dcoref";

    public static PipelineUtil getInstance() {
        return ourInstance;
    }

    public static StanfordCoreNLP getPipeline(String annotators) {
        Properties props = new Properties();
        props.put("annotators", annotators);
        StanfordCoreNLP pipeline = new StanfordCoreNLP(props);
        return pipeline;
    }

    private PipelineUtil() {
        Properties props = new Properties();
        props.put("annotators", BASE_ANNOTATORS);
        this.pipeline = new StanfordCoreNLP(props);
    }

    public StanfordCoreNLP getPipeline() {
        return pipeline;
    }


}
